package com.ljb.utilslibary_master;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;

import com.ljb.utilslibrary.commUtils.L;
import com.ljb.utilslibrary.commUtils.SP;

/**
 * Created by ljb on 2017/6/23.
 */

public class SPActivity extends BaseActivity implements View.OnClickListener {

    public static void actionStart(Context c) {
        c.startActivity(new Intent(c, SPActivity.class));
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_sp);
        findViewById(R.id.bt_put).setOnClickListener(this);
        findViewById(R.id.bt_get).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.bt_put:
                SP.putEffective(this, "key", "heheda", 5);
                L.e("key = " + SP.getEffectiveOrExpired(this, "key", "空1"));
                break;
            case R.id.bt_get:
                L.e("key = " + SP.getEffectiveOrExpired(this, "key", "空2"));
                L.e("key2=" + SP.get(this, "key", "空3"));
                break;
        }
    }
}
